# 对应CSDN python系列专栏博客
# 对应2024/03/27 的python博客
# 主题：【Python】python编程初探2---字符编码，输入和输出，初识数据类型
"""
# 1.10 字符间的相互转换
# str.encode()函数和str.decode()函数
unicode = "博客"
print("Unicode:", type(unicode), ",", unicode)
utf8 = unicode.encode("utf8")
print("UTF-8:", type(utf8), ",", utf8)
utf16 = unicode.encode("utf16")
print("UTF-16:", type(utf16), ",", utf16)
utf32 = unicode.encode("utf32")
print("UTF-32:", type(utf32), ",", utf32)
gbk = unicode.encode("gbk")
print("GBK:", type(gbk), ",", gbk)

de_gbk = gbk.decode("gbk")
print("De_GBK:", type(de_gbk), ",", de_gbk)

# 二、输入与输出
# 2.1 input()输入
print("请输入你的博客名字")
csdn_name = input()
print("你的博客名字为:", csdn_name)

# 我们可以简化头两行
csdn_name = input("请输入你的博客名字")

# 不推荐中文标识符
名字 = input("请输入你的名字")

# 2.2 输出
print("Hello, world!")

name = "Alice"
age = 30
print("Name:", name, "Age:", age, sep='-')
"""
a = 100

# 字符串格式化：%s
print("a = %s" % a)

# 整数格式化：%d
print("a = %d" % a)

# 浮点数格式化：%f
print("a = %f" % a)

# 十六进制格式化：%x
print("a = %x" % a)

# 八进制格式化：%o
print("a = %o" % a)

name = "Alice"
age = 30
print(f"Name: {name}, Age: {age}")


name = "Alice"
age = 30
print("Name: {}, Age: {}".format(name, age))
